package clue_utils

import (
	"errors"
	"hft/e"
	"hft/global"
	"hft/tools"
)

func ValidPhone(phone string) (err error) {
	if cate := tools.CheckPhoneNumber(phone); cate == 0 {
		tools.AliyunSmsTool.SendValid(global.OC_CONFIG.AliyunSms.UserSend, phone, global.OC_CONFIG.AliyunSms.SmsModel)
		return nil
	} else if cate == 1 || cate == 2 {
		newPhone := tools.IsAddRegion(phone, cate)
		tools.AliyunSmsTool.SendValid(global.OC_CONFIG.AliyunSms.UserSend, newPhone, global.OC_CONFIG.AliyunSms.SmsHKModel)
		return nil
	} else {
		return errors.New(e.PhoneNotRight)
	}
}
